package top.maof.book.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.maof.book.search.Search;
import top.maof.lightsearch.core.LightSearch;

@Configuration
public class SearchConfig {

    @Value("${search.path}")
    String path;

    @Value("${path.light-search}")
    String lightSearchPath;

    @Bean
    public Search search() throws Exception {
        Search search = new Search(path);
        search.startRead();
        search.startWrite();
        return search;
    }

    @Bean
    public LightSearch lightSearch() throws Exception {
        LightSearch search = new LightSearch(lightSearchPath);
        return search;
    }
}
